home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / prog_c / cuj0696.zip / DWYER.ZIP / LIB / CONST.C < prev    next >
C/C++ Source or Header  |  1995-10-03  |  7KB  |  199 lines

  1. /*                            const.c
  2.  *
  3.  *    Globally declared constants
  4.  *
  5.  *
  6.  *
  7.  * SYNOPSIS:
  8.  *
  9.  * extern double nameofconstant;
  10.  *
  11.  *
  12.  *
  13.  *
  14.  * DESCRIPTION:
  15.  *
  16.  * This file contains a number of mathematical constants and
  17.  * also some needed size parameters of the computer arithmetic.
  18.  * The values are supplied as arrays of hexadecimal integers
  19.  * for IEEE arithmetic; arrays of octal constants for DEC
  20.  * arithmetic; and in a normal decimal scientific notation for
  21.  * other machines.  The particular notation used is determined
  22.  * by a symbol (DEC, IBMPC, or UNK) defined in the include file
  23.  * mconf.h.
  24.  *
  25.  * The default size parameters are as follows.
  26.  *
  27.  * For DEC and UNK modes:
  28.  * MACHEP =  1.38777878078144567553E-17       2**-56
  29.  * MAXLOG =  8.8029691931113054295988E1       log(2**127)
  30.  * MINLOG = -8.872283911167299960540E1        log(2**-128)
  31.  * MAXNUM =  1.701411834604692317316873e38    2**127
  32.  *
  33.  * For IEEE arithmetic (IBMPC):
  34.  * MACHEP =  1.11022302462515654042E-16       2**-53
  35.  * MAXLOG =  7.09782712893383996843E2         log(2**1024)
  36.  * MINLOG = -7.08396418532264106224E2         log(2**-1022)
  37.  * MAXNUM =  1.7976931348623158E308           2**1024
  38.  *
  39.  * The global symbols for mathematical constants are
  40.  * PI     =  3.14159265358979323846           pi
  41.  * PIO2   =  1.57079632679489661923           pi/2
  42.  * PIO4   =  7.85398163397448309616E-1        pi/4
  43.  * SQRT2  =  1.41421356237309504880           sqrt(2)
  44.  * SQRTH  =  7.07106781186547524401E-1        sqrt(2)/2
  45.  * LOG2E  =  1.4426950408889634073599         1/log(2)
  46.  * SQ2OPI =  7.9788456080286535587989E-1      sqrt( 2/pi )
  47.  * LOGE2  =  6.93147180559945309417E-1        log(2)
  48.  * LOGSQ2 =  3.46573590279972654709E-1        log(2)/2
  49.  * THPIO4 =  2.35619449019234492885           3*pi/4
  50.  * TWOOPI =  6.36619772367581343075535E-1     2/pi
  51.  *
  52.  * These lists are subject to change.
  53.  */
  54.  
  55. /*                            const.c */
  56.  
  57. /*
  58. Cephes Math Library Release 2.0:  April, 1987
  59. Copyright 1984, 1987 by Stephen L. Moshier
  60. Direct inquiries to 30 Frost Street, Cambridge, MA 02140
  61. */
  62.  
  63. #include "mconf.h"
  64.  
  65. #ifdef UNK
  66. double MACHEP =  1.38777878078144567553E-17;   /* 2**-56 */
  67. double MAXLOG =  8.8029691931113054295988E1;   /* log(2**127) */
  68. double MINLOG = -8.872283911167299960540E1;    /* log(2**-128) */
  69. double MAXNUM =  1.701411834604692317316873e38; /* 2**127 */
  70. double PI     =  3.14159265358979323846;       /* pi */
  71. double PIO2   =  1.57079632679489661923;       /* pi/2 */
  72. double PIO4   =  7.85398163397448309616E-1;    /* pi/4 */
  73. double SQRT2  =  1.41421356237309504880;       /* sqrt(2) */
  74. double SQRTH  =  7.07106781186547524401E-1;    /* sqrt(2)/2 */
  75. double LOG2E  =  1.4426950408889634073599;     /* 1/log(2) */
  76. double SQ2OPI =  7.9788456080286535587989E-1;  /* sqrt( 2/pi ) */
  77. double LOGE2  =  6.93147180559945309417E-1;    /* log(2) */
  78. double LOGSQ2 =  3.46573590279972654709E-1;    /* log(2)/2 */
  79. double THPIO4 =  2.35619449019234492885;       /* 3*pi/4 */
  80. double TWOOPI =  6.36619772367581343075535E-1; /* 2/pi */
  81. #endif
  82.  
  83. #ifdef IBMPC
  84.             /* 2**-53 =  1.11022302462515654042E-16 */
  85. short MACHEP[4] = {0x0000,0x0000,0x0000,0x3ca0};
  86.             /* log(2**1024) =   7.09782712893383996843E2 */
  87. short MAXLOG[4] = {0x39ef,0xfefa,0x2e42,0x4086};
  88.             /* log(2**-1022) = - 7.08396418532264106224E2 */
  89. short UNDLOG[4] = {0xbcd2,0xdd7a,0x232b,0xc086};
  90.             /* log(2**-1074) = - -7.44440071921381262314E2 */
  91. short MINLOG[4] = {0x71c3,0x446d,0x4385,0xc087};
  92.             /* 2**1024*(1-MACHEP) =  1.7976931348623158E308 */
  93. short MAXNUM[4] = {0xffff,0xffff,0xffff,0x7fef};
  94. short PI[4]     = {0x2d18,0x5444,0x21fb,0x4009};
  95. short PIO2[4]   = {0x2d18,0x5444,0x21fb,0x3ff9};
  96. short PIO4[4]   = {0x2d18,0x5444,0x21fb,0x3fe9};
  97. short SQRT2[4]  = {0x3bcd,0x667f,0xa09e,0x3ff6};
  98. short SQRTH[4]  = {0x3bcd,0x667f,0xa09e,0x3fe6};
  99. short LOG2E[4]  = {0x82fe,0x652b,0x1547,0x3ff7};
  100. short SQ2OPI[4] = {0x3651,0x33d4,0x8845,0x3fe9};
  101. short LOGE2[4]  = {0x39ef,0xfefa,0x2e42,0x3fe6};
  102. short LOGSQ2[4] = {0x39ef,0xfefa,0x2e42,0x3fd6};
  103. short THPIO4[4] = {0x21d2,0x7f33,0xd97c,0x4002};
  104. short TWOOPI[4] = {0xc883,0x6dc9,0x5f30,0x3fe4};
  105. #endif
  106.  
  107. #ifdef MIEEE
  108.             /* 2**-53 =  1.11022302462515654042E-16 */
  109. short MACHEP[4] = {
  110. 0x3ca0,0x0000,0x0000,0x0000
  111. };
  112.             /* log(2**1024) =   7.09782712893383996843E2 */
  113. short MAXLOG[4] = {
  114. 0x4086,0x2e42,0xfefa,0x39ef
  115. };
  116.             /* log(2**-1022) = - 7.08396418532264106224E2 */
  117. short MINLOG[4] = {
  118. 0xc086,0x232b,0xdd7a,0xbcd2
  119. };
  120.             /* 2**1024*(1-MACHEP) =  1.7976931348623158E308 */
  121. short MAXNUM[4] = {
  122. 0x7fef,0xffff,0xffff,0xffff
  123. };
  124. short PI[4]     = {
  125. 0x4009,0x21fb,0x5444,0x2d18
  126. };
  127. short PIO2[4]   = {
  128. 0x3ff9,0x21fb,0x5444,0x2d18
  129. };
  130. short PIO4[4]   = {
  131. 0x3fe9,0x21fb,0x5444,0x2d18
  132. };
  133. short SQRT2[4]  = {
  134. 0x3ff6,0xa09e,0x667f,0x3bcd
  135. };
  136. short SQRTH[4]  = {
  137. 0x3fe6,0xa09e,0x667f,0x3bcd
  138. };
  139. short LOG2E[4]  = {
  140. 0x3ff7,0x1547,0x652b,0x82fe
  141. };
  142. short SQ2OPI[4] = {
  143. 0x3fe9,0x8845,0x33d4,0x3651
  144. };
  145. short LOGE2[4]  = {
  146. 0x3fe6,0x2e42,0xfefa,0x39ef
  147. };
  148. short LOGSQ2[4] = {
  149. 0x3fd6,0x2e42,0xfefa,0x39ef
  150. };
  151. short THPIO4[4] = {
  152. 0x4002,0xd97c,0x7f33,0x21d2
  153. };
  154. short TWOOPI[4] = {
  155. 0x3fe4,0x5f30,0x6dc9,0xc883
  156. };
  157. #endif
  158.  
  159. #ifdef DEC
  160.             /* 2**-56 =  1.38777878078144567553E-17 */
  161. short MACHEP[4] = {0022200,0000000,0000000,0000000};
  162.             /* log 2**127 = 88.029691931113054295988 */
  163. short MAXLOG[4] = {041660,007463,0143742,025733,};
  164.             /* log 2**-128 = -88.72283911167299960540 */
  165. short MINLOG[4] = {0141661,071027,0173721,0147572,};
  166.             /* 2**127 = 1.701411834604692317316873e38 */
  167. short MAXNUM[4] = {077777,0177777,0177777,0177777,};
  168. short PI[4]     = {040511,007732,0121041,064302,};
  169. short PIO2[4]   = {040311,007732,0121041,064302,};
  170. short PIO4[4]   = {040111,007732,0121041,064302,};
  171. short SQRT2[4]  = {040265,002363,031771,0157145,};
  172. short SQRTH[4]  = {040065,002363,031771,0157144,};
  173. short LOG2E[4]  = {040270,0125073,024534,013761,};
  174. short SQ2OPI[4] = {040114,041051,0117241,0131204,};
  175. short LOGE2[4]  = {040061,071027,0173721,0147572,};
  176. short LOGSQ2[4] = {037661,071027,0173721,0147572,};
  177. short THPIO4[4] = {040426,0145743,0174631,007222,};
  178. short TWOOPI[4] = {040042,0174603,067116,042025,};
  179.  
  180. extern short MACHEP[];
  181. extern short MAXLOG[];
  182. extern short UNDLOG[];
  183. extern short MINLOG[];
  184. extern short MAXNUM[];
  185. extern short PI[];
  186. extern short PIO2[];
  187. extern short PIO4[];
  188. extern short SQRT2[];
  189. extern short SQRTH[];
  190. extern short LOG2E[];
  191. extern short SQ2OPI[];
  192. extern short LOGE2[];
  193. extern short LOGSQ2[];
  194. extern short THPIO4[];
  195. extern short TWOOPI[];
  196. static char x[] =
  197. "Cephes Math Library Copyright 1987 by Stephen L. Moshier";
  198. #endif
  199.